package com.wangnian.wangcai;

import com.alibaba.fastjson.JSONObject;
import com.wangnian.wangcai.dao.DayInfo;
import com.wangnian.wangcai.scheduled.RunScheduled;
import com.wangnian.wangcai.util.HttpUtil;
import com.wangnian.wangcai.util.Indicators;
import com.wangnian.wangcai.util.TaskUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.domain.Sort;

import java.util.List;

@SpringBootApplication
public class WangCaiApplication implements CommandLineRunner {
    @Value("${spring.profiles.active}")
    private String environment;
    private final RunScheduled runScheduled;

    public WangCaiApplication(RunScheduled runScheduled) {
        this.runScheduled = runScheduled;
    }

    public static void main(String[] args) {
        SpringApplication.run(WangCaiApplication.class, args);
    }

    @Override
    public void run(String... args) {
        if (environment.equals("prod")) {
            TaskUtil.mapCache = JSONObject.parseObject(TaskUtil.readString());
            System.out.println(TaskUtil.mapCache);
            runScheduled.runDay();
        }
//        HttpUtil.get(environment."get_market_data_ex?start_date=20241101&code_list=000001.SZ,000002.SZ,300033.SZ");

    }
}
